<MDXHeader title="Sonner" description="An opinionated toast component for Solid." />

<ComponentPreview name="sonner-demo" />

## About

`solid-sonner` is built and maintained by [wobsoriano](https://github.com/wobsoriano).

## Installation

<Tabs defaultValue="cli">

<TabsList>
  <TabsTrigger value="cli">CLI</TabsTrigger>
  <TabsTrigger value="manual">Manual</TabsTrigger>
</TabsList>

<TabsContent value="cli">

```bash
npx solidui-cli@latest add sonner
```

</TabsContent>

<TabsContent value="manual">
<Steps>

<Step>Install the following dependencies: </Step>

```bash
npm install solid-sonner
```

<Step>Copy and paste the following code into your project: </Step>

<ComponentSource name="sonner" />

<Step>Add the Toaster component:</Step>

```tsx{1,9}
import { Toaster } from "~/components/ui/sonner"

export default function RootLayout({ children }) {
  return (
    <html lang="en">
      <head />
      <body>
        <main>{children}</main>
        <Toaster />
      </body>
    </html>
  )
}
```

</Steps>
</TabsContent>

</Tabs>

## Usage

```tsx
import { toast } from "solid-sonner"
```

```tsx
toast("Event has been created.")
```
